package com.minimalist.common.entity.basic.vo.storage;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.minimalist.common.config.swagger.SchemaEnum;
import com.minimalist.common.entity.basic.enums.StatusEnum;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.io.Serial;
import java.io.Serializable;

/**
 * @author 11987
 */
@Schema(name = "存储信息实体")
public class StorageVO implements Serializable{

    @Serial
    private static final long serialVersionUID = 1L;

    @JsonSerialize(using = ToStringSerializer.class)
    @NotNull(message = "存储ID不能为空", groups = {Update.class})
    @Schema(name = "storageId", description = "存储ID", type = "string")
    private Long storageId;

    @NotBlank(message = "存储名称不能为空", groups = {Add.class, Update.class})
    @Schema(name = "storageName", description = "存储名称", type = "string")
    private String storageName;

    @NotBlank(message = "存储类型不能为空", groups = {Add.class, Update.class})
    @Schema(name = "storageType", description = "存储类型", type = "string")
    private String storageType;

    @Schema(name = "description", description = "说明", type = "integer")
    private String description;

    @NotBlank(message = "存储配置不能为空", groups = {Add.class, Update.class})
    @Schema(name = "storageConfig", description = "存储配置", type = "string")
    private String storageConfig;

    @NotNull(message = "存储状态不能为空", groups = {Update.class})
    @SchemaEnum(implementation = StatusEnum.class)
    @Schema(name = "status", description = "存储状态", type = "integer")
    private Integer status;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "tenantId", description = "租户ID", type = "string")
    private Long tenantId;

    public Long getStorageId() {
        return storageId;
    }

    public void setStorageId(Long storageId) {
        this.storageId = storageId;
    }

    public String getStorageName() {
        return storageName;
    }

    public void setStorageName(String storageName) {
        this.storageName = storageName;
    }

    public String getStorageType() {
        return storageType;
    }

    public void setStorageType(String storageType) {
        this.storageType = storageType;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getStorageConfig() {
        return storageConfig;
    }

    public void setStorageConfig(String storageConfig) {
        this.storageConfig = storageConfig;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Long getTenantId() {
        return tenantId;
    }

    public void setTenantId(Long tenantId) {
        this.tenantId = tenantId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        StorageVO storageVO = (StorageVO) o;
        return java.util.Objects.equals(storageId, storageVO.storageId) &&
               java.util.Objects.equals(storageName, storageVO.storageName) &&
               java.util.Objects.equals(storageType, storageVO.storageType) &&
               java.util.Objects.equals(description, storageVO.description) &&
               java.util.Objects.equals(storageConfig, storageVO.storageConfig) &&
               java.util.Objects.equals(status, storageVO.status) &&
               java.util.Objects.equals(tenantId, storageVO.tenantId);
    }

    @Override
    public int hashCode() {
        return java.util.Objects.hash(storageId, storageName, storageType, description, storageConfig, status, tenantId);
    }

    @Override
    public String toString() {
        return "StorageVO{" +
               "storageId=" + storageId +
               ", storageName='" + storageName + '\'' +
               ", storageType='" + storageType + '\'' +
               ", description='" + description + '\'' +
               ", storageConfig='" + storageConfig + '\'' +
               ", status=" + status +
               ", tenantId=" + tenantId +
               '}';
    }

}
